import { observable, action } from 'mobx'
import * as api from 'lib/constants/api'
import { post } from 'lib/net'
import Toast from 'components/toast'
import Load from 'components/load'

// class AddressModel {
//   constructor (data) {
//     if (data) {
//     }
//   }
// }

export default class AccuseRecordVM {
  constructor (props) {
    this.props = props
    this.PageInitialization()
  }

  // 记录
  @observable record = false

  // 个人中心客户投诉记录
  @observable accuseRecordDetail = []

  @action PageInitialization = async () => {
    Load.loading(1, '加载中')
    const UserId = window.localStorage.getItem('UserId')
    let response = await post(api.GETCOMPLATIONBYWZ, { WZId: UserId, RecordType: 1 })
    if (response.Success) {
      Load.loading(2, '加载完成')
      this.accuseRecordDetail = response.Value
      setTimeout(() => {
        this.record = true
      })
    } else {
      Toast.fail(response.Message)
    }
  }
}
